<template>
  <!-- 巡检结果 -->
  <div class="inspection-result-box">
    <div class="locklontrol-box borderStyle centerbox relative">
      <div class="title centertitleStyle centerbox title-relative">巡检结果</div>
      <div class="details-box colcenterbox">
        <el-table
        border
          :data="xjjgData"
          @selection-change="handleSelectionChange"
          :row-class-name="tableRowClassName"
        >
          <el-table-column prop="HJJCMC" label="巡检内容" :show-overflow-tooltip="true"></el-table-column>
          <el-table-column prop="JCSJ" label="巡检时间" :show-overflow-tooltip="true"></el-table-column>
          <el-table-column prop="XJJG" label="结果" :show-overflow-tooltip="true" width="130"></el-table-column>
          <el-table-column prop="XSJGMC" label="结论" :show-overflow-tooltip="true"></el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
interface tableDataList {
  index: number;
  inspectionCont: string;
  inspectionTime: string;
  result: string;
  conclusion: string;
}
interface objType {
  row: object;
  rowIndex: number;
}
@Component
export default class extends Vue {
  tableData: Array<tableDataList> = [
    {
      index: 1,
      inspectionCont: "10kV甲消弧线圆柜温控器手动指示灯",
      inspectionTime: "2018-11-14 09：00：36",
      result: "正常",
      conclusion: "正常"
    },
  ];
  tableSelect: Array<object> = [];

  // 表格选择事件
  handleSelectionChange(val: any): void {
    // console.log(val);

    this.tableSelect = val;
  }
  // 表格隔行变色
  tableRowClassName({ row, rowIndex }: objType): string {
    // console.log(row, rowIndex);
    if (rowIndex % 2 === 1) {
      return "row1";
    } else {
      return "row2";
    }
  }

  // 巡检结果
  private xjjgData = [
    {
      xjnr: "10kV甲消弧线圆柜温控器手动指示灯", // 巡检内容
      xjsj: "2018-11-14 09：00", // 巡检时间
      jg: "正常", // 结果
      jl: "正常" // 结论
    }
  ];

  get newxjjgData() {
    let xjjgData = this.xjjgData;
    return xjjgData;
  }

  private init() {
    // 获取变电站巡检结果
    (this as any).$services
      .getXjjgData({
        method: "get",
        data: {
          bdzId: this.$route.query.BDZID
        }
      })
      .then((result: any) => {
        this.xjjgData = result.data.xjjgData;
      })
      .catch((err: object) => {
        console.log(err);
      });
  }

  created() {
    this.init();
  }
}
</script>

<style lang="scss" scoped>
.inspection-result-box {
  width: 100%;
  height: 100%;
  .locklontrol-box {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    .title {
      cursor: pointer;
      z-index: 1;
    }
    .details-box {
      width: 100%;
      height: calc(100% - 0.4rem);
      margin-top: 0.3rem;
    }
  }
}
</style>
<style lang="scss">
.inspection-result-box {
  .el-table .cell {
    font-size: 0.14rem;
    text-align: center;
    white-space: nowrap;
  }

  .el-table th > .cell {
    font-size: 0.18rem;
  }

  .el-table th {
    padding: 0.08rem 0;
    font-weight: 400;
  }

  .el-table td,
  .el-table th.is-leaf {
    border-bottom: 0px solid #ebeef5;
  }

  .el-table .row1 {
    background: rgb(41, 171, 226, 0.16);
  }

  .el-table .row2 {
    background: #021d54;
  }

  .el-table__header th {
    background: rgba(0, 180, 255, 0.4);
  }
  .el-table__body td {
    padding: 0.02rem 0;
  }

  .tbody tr:hover {
    background: rgb(41, 171, 226, 0.4);
    cursor: pointer;
  }

  .el-table::before {
    background-color: transparent;
  }
  .el-button {
    padding: 0 0.08rem;
    margin: 0 auto;
  }
  .el-button--primary {
    height: 0.2rem;
  }
}
</style>

